/**
 * bm.cp10.common
 * cp10
 */
package cn.ac.iscas.chimaera.common;

import org.displaytag.decorator.ColumnDecorator;
import java.util.Date;

import org.apache.commons.lang.time.FastDateFormat;

/**
 * @author yang yu
 *
 * @mail  yangyu@iscas.as.cn
 *
 * @time 2010-3-2上午10:18:31
 * 
 */
public class Displaytagdateformat implements ColumnDecorator {
	
	/**
     * FastDateFormat used to format the date object.
     */
    private FastDateFormat dateFormat = FastDateFormat.getInstance("yyyy-MM-dd"); //$NON-NLS-1$

    /**
     * transform the given object into a String representation. The object is supposed to be a date.
     * @param columnValue Object
     * @return String
     */
    public final String decorate(Object columnValue)
    {
        if(columnValue == null)
        	return "";
    	Date date = (Date) columnValue;
        return this.dateFormat.format(date);
    }

}
